#ifndef PEG_H
#define PEG_H

#include <QGraphicsItem>

class Hole;

class Peg : public QGraphicsItem
{
    const qreal m_radius;
    const int m_outline_width = 1;
    Hole *m_hole;
public:
    explicit Peg(Hole *hole);

    QRectF boundingRect() const;
    void paint(QPainter *painter,
               const QStyleOptionGraphicsItem *option,
               QWidget *widget);
    QPainterPath shape() const;
    void mousePressEvent(QGraphicsSceneMouseEvent *event);
    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);

    Hole *setHole(Hole *hole);
    Hole *hole() const;

private:
    bool isFeasibleHole(const Hole *source, const Hole *target) const;
    void removeJumpedPeg(const Hole *source, const Hole *target) const;

signals:
    
public slots:
    
};

#endif // PEG_H
